package com.atguigu.jxc.service.impl;

import com.atguigu.jxc.dao.ListGoodsDao;
import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.entity.DamageList;
import com.atguigu.jxc.entity.DamageListGoods;
import com.atguigu.jxc.entity.OverflowList;
import com.atguigu.jxc.entity.OverflowListGoods;
import com.atguigu.jxc.service.ListGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 *
 * @Author 花鸟の虫鱼
 * @CreateDate 21/9/7 16:22
 * @Version 1.0
 * @Description TODO
 */
@Service
public class ListGoodsServiceImpl implements ListGoodsService {
    @Autowired
    private ListGoodsDao overflowListDao;

    @Autowired
    private ListGoodsDao damageListDao;

    @Override
    public String selectLoadGoodsType() {


        return null;
    }

    @Override
    public ServiceVO savedamageList(DamageList damageList, String damageListGoodsStr) {
        return damageListDao.insertDamageList(damageList,damageListGoodsStr);
    }

    @Override
    public ServiceVO saveOverflowList(OverflowList overflowList, String overflowListGoodsStr) {
        return overflowListDao.insertOverflowList(overflowList,overflowListGoodsStr);
    }

    @Override
    public Map<String, Object> selectdamageList(String sTime, String eTime) {
        Map<String, Object> map = new HashMap<>();
        List<DamageList> damageLists = damageListDao.getDamageList(sTime, eTime);
        map.put("rows",damageLists);
//        map.put("total",damageListDao.getDamageListCount());
        return map;
    }

    @Override
    public Map<String, Object> selectoverflowList(String sTime, String eTime) {
        Map<String, Object> map = new HashMap<>();
        List<OverflowList> overflowLists = overflowListDao.getoverflowList(sTime, eTime);
        map.put("rows",overflowLists);
//        map.put("total",overflowListDao.getoverflowListCount());
        return map;
    }

    @Override
    public Map<String, Object> selectdamageListDetail(Integer damageListId) {
        Map<String, Object> map = new HashMap<>();
        List<DamageListGoods> damageLists = damageListDao.getDamageListDetail(damageListId);
        map.put("rows",damageLists);
//        map.put("total",damageListDao.getDamageListCount());
        return map;
    }

    @Override
    public Map<String, Object> selectoverflowListDetail(Integer overflowListId) {
        Map<String, Object> map = new HashMap<>();
        List<OverflowListGoods> overflowLists = overflowListDao.getOverflowListDetail(overflowListId);
        map.put("rows",overflowLists);
//        map.put("total",overflowListDao.getoverflowListCount());
        return map;
    }
}
